import { BaseController } from '@/api/BaseController';
import { RequestOption } from '@/common/http/types';
import { ANY_OBJECT } from '@/types/generic';
import { TableData } from '@/common/types/table';
import { useUrlBuilder } from '@/common/hooks/useUrl';
import TicketInfo from '@/types/table/ticketInfo';
import { API_CONTEXT } from '../config';

const { buildGetUrl } = useUrlBuilder();

export interface TicketInfoData extends TicketInfo {
  __cascade_add_temp_id__?: string | number | undefined;
}

export default class TicketInfoController extends BaseController {
  static list(params: ANY_OBJECT, httpOptions?: RequestOption) {
    return super.post<TableData<TicketInfoData>>(API_CONTEXT + '/app/ticketInfo/list', params, httpOptions);
  }
  static view(params: ANY_OBJECT, httpOptions?: RequestOption) {
    return super.get<TicketInfoData>(API_CONTEXT + '/app/ticketInfo/view', params, httpOptions);
  }
  static export(params: ANY_OBJECT, fileName: string) {
    return super.download(API_CONTEXT + '/app/ticketInfo/export', params, fileName);
  }
  static import(params: ANY_OBJECT) {
    return super.upload(API_CONTEXT + '/app/ticketInfo/import', params);
  }
  static printUrl(params: ANY_OBJECT) {
    return buildGetUrl(API_CONTEXT + '/app/ticketInfo/print', params);
  }
  static add(params: ANY_OBJECT, httpOptions?: RequestOption) {
    return super.post(API_CONTEXT + '/app/ticketInfo/add', params, httpOptions);
  }
  static update(params: ANY_OBJECT, httpOptions?: RequestOption) {
    return super.post(API_CONTEXT + '/app/ticketInfo/update', params, httpOptions);
  }
  static delete(params: ANY_OBJECT, httpOptions?: RequestOption) {
    return super.post(API_CONTEXT + '/app/ticketInfo/delete', params, httpOptions);
  }
  static deleteBatch(params: ANY_OBJECT, httpOptions?: RequestOption) {
    return super.post(API_CONTEXT + '/app/ticketInfo/deleteBatch', params, httpOptions);
  }
  static startOnlyGgFlow(params: ANY_OBJECT, httpOptions?: RequestOption) {
    return super.post(API_CONTEXT + '/app/ticketInfo/startOnly/ggFlow', params, httpOptions);
  }
  static startWithBusinessKeyGgFlow(params: ANY_OBJECT, httpOptions?: RequestOption) {
    return super.post(API_CONTEXT + '/app/ticketInfo/startWithBusinessKey/ggFlow', params, httpOptions);
  }
  static startAndTakeUserTaskGgFlow(params: ANY_OBJECT, httpOptions?: RequestOption) {
    return super.post(API_CONTEXT + '/app/ticketInfo/startAndTakeUserTask/ggFlow', params, httpOptions);
  }
  static startAndSaveDraftGgFlow(params: ANY_OBJECT, httpOptions?: RequestOption) {
    return super.post(API_CONTEXT + '/app/ticketInfo/startAndSaveDraft/ggFlow', params, httpOptions);
  }
  static submitUserTaskGgFlow(params: ANY_OBJECT, httpOptions?: RequestOption) {
    return super.post(API_CONTEXT + '/app/ticketInfo/submitUserTask/ggFlow', params, httpOptions);
  }
  static viewTaskBusinessDataGgFlow(params: ANY_OBJECT, httpOptions?: RequestOption) {
    return super.get(API_CONTEXT + '/app/ticketInfo/viewTaskBusinessData/ggFlow', params, httpOptions);
  }
  static viewHistoricTaskBusinessDataGgFlow(params: ANY_OBJECT, httpOptions?: RequestOption) {
    return super.get(API_CONTEXT + '/app/ticketInfo/viewHistoricTaskBusinessData/ggFlow', params, httpOptions);
  }
  static listWorkOrderGgFlow(params: ANY_OBJECT, httpOptions?: RequestOption) {
    return super.post(API_CONTEXT + '/app/ticketInfo/listWorkOrder/ggFlow', params, httpOptions);
  }
}
